const RouteView = () => import('@/layout/RouteView');
// 异步路由组件加载
const AsyncComponent = __name__ => () => import(`@/pages/${__name__}`);

// 菜单路由
const saleRoutes = [
  {
    path: '/retail',
    meta: { title: '销售管理', icon: 'el-icon-s-flag' },
    redirect: '/retail',
    component: RouteView,
    children: [
      {
        path: '/retail/basedata',
        meta: { title: '系统参数' },
        // redirect: '/retail/basedata/',
        component: RouteView,
        children: [
          {
            path: '/retail/basedata/definition/index',
            meta: { title: '订单审核定义', keepAlive: true },
            component: AsyncComponent('retail/basedata/definition/index')
          },
          {
            path: 'maintenance/index',
            meta: { title: '维护费用项目', keepAlive: true },
            component: AsyncComponent('retail/basedata/maintenance/index')
          },
          {
            path: '/retail/basedata/store/index',
            meta: { title: '仓库定义', keepAlive: true },
            component: AsyncComponent('retail/basedata/store/index')
          }
        ]
      },
      {
        path: '/retail/salesmanage',
        meta: { title: '订单管理' },
        redirect: '/retail/salesmanage/salesordermanage/index',
        component: RouteView,
        children: [
          {
            path: '/retail/salesmanage/salesordermanage/index',
            meta: { title: '客户订单', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/salesordermanage/index')
          },
          {
            path: '/retail/salesmanage/managerverify/index',
            meta: { title: '订单经理审核', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/managerverify/index')
          },
          {
            path: '/retail/salesmanage/financeverify/index',
            meta: { title: '订单财务审核', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/financeverify/index')
          },
          {
            path: '/retail/salesmanage/confirmcar/index',
            meta: { title: '订单配车', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/confirmcar')
          },
          {
            path: '/retail/salesmanage/salesorder/index',
            meta: { title: '销售订单', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/salesorder/index')
          },
          {
            path: '/retail/salesmanage/sellback/index',
            meta: { title: '销售退回', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/sellback/index')
          },
          {
            path: '/retail/salesmanage/definition/index',
            meta: { title: '订单审核定义', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/definition/index')
          },
          {
            path: '/retail/salesmanage/solidReport/index',
            meta: { title: '实销上报', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/solidReport/index')
          },
          {
            path: '/retail/salesmanage/deliveryManagement/index',
            meta: { title: '交车管理', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/deliveryManagement/index')
          },
          {
            path: '/retail/salesmanage/vehicleReturn/index',
            meta: { title: '整车退单', keepAlive: true },
            component: AsyncComponent('retail/salesmanage/vehicleReturn/index')
          },
        ]
      },
      {
        path: '/vehicle/stockmanage',
        meta: { title: '车辆库存' },
        redirect: '/vehicle/stockmanage/InventoryMaintenance/index',
        component: RouteView,
        children: [
          {
            path: '/vehicle/stockmanage/stockIn/index',
            meta: { title: '车辆入库', keepAlive: true },
            component: AsyncComponent('vehicle/stockmanage/stockIn/index')
          },
          {
            path: '/vehicle/stockmanage/stockOut/index',
            meta: { title: '车辆出库', keepAlive: true },
            component: AsyncComponent('vehicle/stockmanage/stockOut/index')
          },
          {
            path: '/vehicle/stockmanage/InventoryMaintenance/index',
            meta: { title: '车辆库存查询', keepAlive: true },
            component: AsyncComponent('vehicle/stockmanage/InventoryMaintenance/index')
          }
        ]
      },
      {
        path: '/vehicle/salesTargetManagement',
        meta: { title: '销售目标管理' },
        redirect: '/vehicle/salesTargetManagement/salesTarget/index',
        component: RouteView,
        children: [
          {
            path: '/vehicle/salesTargetManagement/salesTarget/index',
            meta: { title: '销售目标设定', keepAlive: true },
            component: AsyncComponent('vehicle/salesTargetManagement/salesTarget/index')
          },
          {
            path: '/vehicle/salesTargetManagement/salesSituation/index',
            meta: { title: '销售情况查询', keepAlive: true },
            component: AsyncComponent('vehicle/salesTargetManagement/salesSituation/index')
          }
        ]
      }
    ]
  }
];

export default saleRoutes;
